﻿using System;
using System.Collections.Generic;

namespace SessionHunter.DataAccess
{
    /// <summary>
    /// Single object of the current options in the system.  It is here as a convenience since many methods change their logic considerably based on
    /// the currently selected options
    /// </summary>
    [Serializable]
    public class ApplicationOptions
    {
        #region Consts
        /// <summary>
        /// The default number of sessions to show if we don't override the value
        /// </summary>
        public const int DefaultNumberOfSessions = 20;
        /// <summary>
        /// If we want to show all sessions, this is the value we save in the settings
        /// </summary>
        public const int ShowAllSessionsValue = -1;
        #endregion

        #region Enums
        /// <summary>
        /// Defines the order we get the data out
        /// </summary>
        public enum OrderByParameter
        {
            /// <summary>
            /// Order it by the largest session first
            /// </summary>
            LargestSession,
            /// <summary>
            /// Order it by the session id
            /// </summary>
            SessionId,
            /// <summary>
            /// Order it the create date, most recent first
            /// </summary>
            CreateDateMostRecent,
            /// <summary>
            /// Order it the create date, least recent first
            /// </summary>
            CreateDateLeastRecent
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationOptions"/> class with default values.
        /// </summary>
        public ApplicationOptions()
        {
            NumberOfSessions = DefaultNumberOfSessions;
            OrderBy = OrderByParameter.LargestSession;
            Application = false;
            ShowCreateExpires = true;
            ShowLockInfo = false;
        }

        /// <summary>
        /// Gets or sets the number of sessions to display.
        /// If -1, bring back all sessions
        /// </summary>
        /// <value>
        /// The number of sessions.
        /// </value>
        public int NumberOfSessions
        {
            get;
            set;
        }

        /// <summary>
        /// The order to return the data in
        /// </summary>
        /// <value>
        /// The order by direction.
        /// </value>
        public OrderByParameter OrderBy
        {
            get;
            set;
        }

        /// <summary>
        /// Whether to show the application data or not
        /// </summary>
        /// <value>
        /// The application.
        /// </value>
        public bool Application
        {
            get;
            set;
        }

        /// <summary>
        /// If set to <c>true</c> shows create/expires columns
        /// </summary>
        /// <value>
        ///   <c>true</c> if shows create/expires columns otherwise, <c>false</c>.
        /// </value>
        public bool ShowCreateExpires
        {
            get;
            set;
        }

        /// <summary>
        /// If set to <c>true</c> shows lock info columns
        /// </summary>
        /// <value>
        ///   <c>true</c> if [show lock info]; otherwise, <c>false</c>.
        /// </value>
        public bool ShowLockInfo
        {
            get;
            set;
        }

        /// <summary>
        /// Stores the list of paths to assemblies we need to load
        /// </summary>
        /// <value>
        /// The reference paths.
        /// </value>
        public List<string> ReferencePaths
        {
            get;
            set;
        }
    }
}
